package com.jsgt.greekfire.ui.gfc.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.fhx.core.utils.LogUtils
import com.jsgt.greekfire.R
import com.jsgt.greekfire.bean.OtcAdBean
import com.jsgt.greekfire.common.util.UtilsBigDecimal
import java.math.BigDecimal

class GFCCoinAdapter(
    context: Context,
    layoutId: Int,
    data: MutableList<OtcAdBean.ListBean>? = null
) : BaseQuickAdapter<OtcAdBean.ListBean, BaseViewHolder>(layoutId, data) {
    override fun convert(helper: BaseViewHolder, item: OtcAdBean.ListBean) {
        var num1 = UtilsBigDecimal.mul(item?.dealAmount, 7.0,2)
        var div = UtilsBigDecimal.div(item?.turnoverNum, item?.dealNum)
        var num = UtilsBigDecimal.mul(div, 100.0,BigDecimal.ROUND_DOWN)
            helper.setText(R.id.tvName, item?.coinCode)
                .setText(R.id.tvTransactionRate,context.resources.getString(R.string.coinList_text2)+item?.turnoverNum)
                .setText(R.id.tvTransaction,"成交量"+num+"%")
                .setText(R.id.tvNum, context.resources.getString(R.string.coinList_text3)+item?.dealNum+"GFC")
                .setText(R.id.tvLimit, "总额"+item?.totalAmount+"  USDT")
                .setText(R.id.tvCurrentPrices, "¥"+num1)
                .setText(R.id.tvCurrent, "/USDT")
        LogUtils.error("GFCCoinAdapter+GFCCoinAdapter =="+item?.dealAmount)
    }

}